package com.foreveross.taskservice.core.domain.task.assign;

import org.dayatang.domain.InstanceFactory;
/**
 * 任务模板生成日期频率类型
 * @author xiangsf 2014-5-30
 *
 */
public enum AssignDayType {

	Between, Fixed, Day, Week, Month, Quarter;
	
	public static AssignBuildQueue assignBean(AssignDayType type){
		switch(type){
			case Between: return InstanceFactory.getInstance(AssignBuildQueue.class, "betweenAssignBuildQueue");
			case Fixed:   return InstanceFactory.getInstance(AssignBuildQueue.class, "fixedAssignBuildQueue");
			case Day:   return InstanceFactory.getInstance(AssignBuildQueue.class, "dayAssignBuildQueue");
			case Week:    return InstanceFactory.getInstance(AssignBuildQueue.class, "weekvBuildQueue");
			case Month:   return InstanceFactory.getInstance(AssignBuildQueue.class, "monthAssignBuildQueue");
			case Quarter: return InstanceFactory.getInstance(AssignBuildQueue.class, "quarterAssignBuildQueue");
			default : return null;
		}
	}
	
	public static AssignDayType convert(int dayType){
		if(dayType == 1){
			return Between;
		}else if(dayType == 2){
			return Fixed;
		}else if(dayType == 3){
			return Week;
		}else if(dayType == 4){
			return Month;
		}else if(dayType == 5){
			return Quarter;
		}else if(dayType == 6){
			return Day;
		}
		return null;
	}
}
